//声明: 该文件需要 swiper,jqueryui,common,toast,jquery

require(["config"], function(config) {
	require(["jquery.ui", "com", "jquery", "zepto", "sw", "toast"], function(jqui, com, jq, zep, sw, t) {
		var newname =com.getCookie("newusername");
		var maysw = new sw('.swiper-container', {
			effect : 'fade',
			autoplay:3000,
			effect : 'cube',
			
			centeredSlides: true,
			loop : true
		});
		jq("#jion2").mousemove(function(){
			jq("#rightcd").css("display","block");	
		});
		jq("#jion2").mouseout(function(){
			jq("#rightcd").css("display","none");
		});
		(function(){
		var now = new Date();
		var h = now.getHours();
		setInterval(function(){	
		var now = new Date();
		var h = now.getHours();
		var m = now.getMinutes();
		var s = now.getSeconds();
		var _date = [
			h<10?0:Math.floor(h/10), h%10,
			m<10?0:Math.floor(m/10), m%10,
			s<10?0:Math.floor(s/10), s%10
			];				
		var imgs = jq(".sjimg");
		for(var i=0; i<imgs.length; i++){
			imgs[i].src = "imag/sy/img/"+_date[i]+".png";
			
		};
		}, 1000);	
		var n=0;
		if(h>=9&&h<11){
			n=1;
		}else if(h>=11&&h<14){
			n=2;
		}else if(h>=14&&h<16){
			n=3;
		}else if(h>=16&&h<22){
			n=4;
		}else if(h>=22&&h<23){
			n=5;
		}else{
			n=6
		}
		console.log(h)
		if(n<6){
			console.log(jq(".zdq li").length)
			jq(".zdq li").eq(n-1).css("color","#900").siblings().css("color","#000");
			jq(".zdq li").eq(n-1).css("line-height","18px");
			jq("<p>整点抢开始</p>").appendTo(jq(".zdq li").eq(n-1));	
		}else{
			null
		}
		
				
}())
		
				
			
		
		jq(".zdqdj").on("click",function(){
					window.location.href="http://127.0.0.1/qebody/spxq.html";	
				})
				
		
		
		jq.ajax({
			type:"get",
			url:"js/sy/sy.json",
			success:function(obj){
				for(var i=0;i<obj.length;i++){
					jq("<div id='rightcd'><div class='righttop'></div><div class='rightbottom'></div></div>").appendTo(jq("#jion2").eq(i));
					jq('<h4>'+obj[i].np[0].eccaidan1+'</h4>').appendTo(jq("#rightcd .righttop").eq(i));
					jq('<h4>'+obj[i].np[1].eccaidan1+'</h4>').appendTo(jq("#rightcd .rightbottom").eq(i));
					for(var j=0;j<obj[i].np[0].eccaidan2.length;j++){
						jq('<a href="#">'+obj[i].np[0].eccaidan2[j]+'</a>').appendTo(jq(".righttop").eq(i));
						jq('<a href="#">'+obj[i].np[1].eccaidan2[j]+'</a>').appendTo(jq(".rightbottom").eq(i));
					};					
				};
				jq("#jion2 li").hover(function(){
					jq("#rightcd").eq(jq(this).index()).show();
				},function(){
					jq("#rightcd").eq(jq(this).index()).hide();
				});
			}
		});
		(function(){
			var ppj = jq("#ppj21 li");
			for(var i=0;i<ppj.length;i++){
				ppj[i].style.background="url(imag/sy/pp"+i+".jpg)";
			}
		}());
		(function(){
			var nrlogo=jq(".nrlogo");
			for(var i=0;i<nrlogo.length;i++){
				nrlogo[i].style.background="url(imag/nrcp"+i+".jpg) no-repeat center";
				nrlogo[i].style.webkitBackgroundSize="100% 100%";
			}
		}())
		jq("#dlxx").hover(function(){
			jq(".dlxx").show();
		},function(){
			jq(".dlxx").hide();
		})
		jq("#dhgwc").hover(function(){
			jq(".dhgwc").show();
		},function(){
			jq(".dhgwc").hide();
		})
		 jq("#dlzd").click(function(e){
            e.preventDefault();
            $(document.documentElement).animate({
                scrollTop: 0
                },1000);
            //支持chrome
            $(document.body).animate({
                scrollTop: 0
                },1000);
        });
        (function(){
        	
        	if(com.getCookie("newusername")){	
        		jq("<span>"+com.getCookie("newusername")+"</span><span id='djtc' style='margin:0 5px'>[退出]<span>").appendTo(jq("#usename"));
        		jq("#usename a").css("display","none");
        	}
        	jq('#djtc').on("click",function(){
        		jq('#usename span').css("display","none");
        		jq("#usename a").css("display","block");
        	})
        }())
	})
})
